package com.gopay.common.trace.def;

import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;

/**
 * @author ddh02
 * @BinaryAnnotation
 * @2017/3/30 9:58  www.gopay.com.cn Inc.All rights reserved.
 */


public class BinaryAnnotation implements Serializable {
    private String key;
    private String value;
    private String type;
    private Integer duration;
    private Endpoint endpoint;
    private String largeValue; //大量数据

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public Endpoint getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(Endpoint endpoint) {
        this.endpoint = endpoint;
    }

    public String getLargeValue() {
        return largeValue;
    }

    public void setLargeValue(String largeValue) {
        this.largeValue = largeValue;
    }

    @Override
    public String toString() {
        return "BinaryAnnotation{" +
                "key='" + key + '\'' +
                ", value=" + value +
                ", type='" + type + '\'' +
                ", duration=" + duration +
                ", endpoint=" + endpoint +
                '}';
    }

    public static void main(String[] args) {

        Endpoint ep = new Endpoint();
        ep.setIp("111.111.111.11");
        ep.setPort(122);
        BinaryAnnotation binaryAnnotation = new BinaryAnnotation();
        binaryAnnotation.setEndpoint(ep);
        binaryAnnotation.setType("order");
        binaryAnnotation.setKey("springmvc.order");
        binaryAnnotation.setValue("aaaa");

        Span span = new Span();

        span.addBinaryAnnotation(binaryAnnotation);

        System.out.println(JSONObject.toJSONString(span));;
    }
}
